<template>
  <div class="Showcase1">
    <div class="Showcase1-top">
      <div
        class="ex-item"
        v-for="(item, index) in props.list"
        :key="index"
        :style="{
          left: `${ShowcaseItemTransform(item.x ? item.x : getParentX(index), item.width, 2.32)}rem`,
        }"
      >
        <p class="name-box">
          {{ item.name }}
        </p>
      </div>
      <img
        class="Showcase1-top-left"
        :src="publicUrls + 'free/style4/Showcase3TopLeft.webp'"
        alt=""
      />
      <img
        class="Showcase1-top-center"
        :src="publicUrls + 'free/style4/Showcase3TopCenter.webp'"
        alt=""
      />
      <img
        class="Showcase1-top-right"
        :src="publicUrls + 'free/style4/Showcase3TopRight.webp'"
        alt=""
      />
    </div>
    <div class="Showcase1-bottom">
      <img
        class="Showcase1-bottom-left"
        :src="publicUrls + 'free/style4/Showcase3BottomLeft.webp'"
        alt=""
      />
      <img
        class="Showcase1-bottom-center"
        :src="publicUrls + 'free/style4/Showcase3BottomCenter.webp'"
        alt=""
      />
      <img
        class="Showcase1-bottom-right"
        :src="publicUrls + 'free/style4/Showcase3BottomRight.webp'"
        alt=""
      />
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free4Style3',
});
</script>
<script lang="ts" setup>
import { publicUrls } from '@/utils/minxin';
import { ShowcaseItemTransform } from '@/utils/setmaterialStyle';
import { defineComponent } from 'vue';
const props = defineProps({
  list: {
    type: Object,
  },
});

const getParentX = (indexs: number) => {
  let x = 0;
  for (let index = 0; index < indexs; index++) {
    // const element = array[index];
    x = x + props.list[index].width;
  }
  return x + 0.3;
};
</script>

<style lang="less" scoped>
.Showcase1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 540px;
  //   min-height: 300px;
  height: 100%;
  position: relative;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.25));
}
.ex-item {
  position: absolute;
  top: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 298px;
  height: 48px;
  background: url('https://static.jiyi.show/free/style4/Showcase3NameBg.png') no-repeat center/100% 100%;
  .name-box {
    width: 270px;
    overflow: hidden;
    text-align: center;
    white-space: nowrap;
    color: #fcffff;
    text-overflow: ellipsis;
    font-family: 'PingFang SC';
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 32px; /* 200% */
  }
}
.Showcase1-top {
  position: relative;
  display: flex;
  height: 100%;
  min-height: 275px;
  width: calc(100% - 45px);
  .Showcase1-top-left {
    width: 118px;
    height: 100%;
  }
  .Showcase1-top-center {
    min-width: 304px;
    flex: 1;
    height: 100%;
  }
  .Showcase1-top-right {
    width: 118px;
    height: 100%;
  }
}
.Showcase1-bottom {
  width: calc(100% - 120px);
  height: 25px;
  display: flex;
  .Showcase1-bottom-center {
    min-width: 304px;
    flex: 1;
    height: 100%;
  }
  .Showcase1-bottom-right,
  .Showcase1-bottom-left {
    width: 80px;
    height: 100%;
  }
}
</style>
